module generic_iobufds(
  output reg O,
  inout IO,
  inout IOB,
  input I,
  input T
);

always @* begin
  if (IO & ~IOB) O <= 1'b1;
  else if (~IO & IOB) O <= 1'b0;
  else if ((IO === 1'bz | ~IO) & (IOB === 1'bz | IOB)) O <= 1'bx;
  else if (IO === 1'bx | IOB === 1'bx) O <= 1'bx;
end

endmodule
